From 389a239f10a341b6fa0cc4aa5a33149f83011143 Mon Sep 17 00:00:00 2001 From: Anton Gladky Date: Mon, 27 Jul 2026 16:37:57 +0200 Subject: [PATCH] Update changelog. --- debian/changelog | 10 +++ ...er_ascii_implicit_cellarray_segfault.patch | 23 ++++++ debian/patches/series | 1 + debian/tests/control | 2 +- debian/tests/writeVTUAsciiImplicitCellTypes | 73 +++++++++++++++++++ 5 files changed, 108 insertions(+), 1 deletion(-) create mode 100644 debian/patches/fix_xmlwriter_ascii_implicit_cellarray_segfault.patch create mode 100755 debian/tests/writeVTUAsciiImplicitCellTypes diff --git a/debian/changelog b/debian/changelog index bce6ba799..c94fa9e37 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,13 @@ +vtk9 (9.6.2+dfsg1-3) unstable; urgency=medium + + * Team upload. + * debian patch fix_xmlwriter_ascii_implicit_cellarray_segfault.patch + fixes segfault writing ascii .vtu files with implicit cell type + arrays, fixing yade FTBFS. + * add autopkgtest writeVTUAsciiImplicitCellTypes covering this bug. + + -- Anton Gladky Mon, 27 Jul 2026 16:37:42 +0200 + vtk9 (9.6.2+dfsg1-2) unstable; urgency=medium * Team upload diff --git a/debian/patches/fix_xmlwriter_ascii_implicit_cellarray_segfault.patch b/debian/patches/fix_xmlwriter_ascii_implicit_cellarray_segfault.patch new file mode 100644 index 000000000..7f303b40a --- /dev/null +++ b/debian/patches/fix_xmlwriter_ascii_implicit_cellarray_segfault.patch @@ -0,0 +1,23 @@ +Description: Fix segfault writing ascii .vtu files with implicit cell type arrays + NewIterator() returns nullptr for the implicit cell-type arrays used + since VTK 9.6. WriteAsciiData() dereferenced that nullptr via an + unconditional iter->Delete(). Guard it. Closes yade FTBFS. +Forwarded: not-yet +Author: Anton Gladky + +Index: vtk9/IO/XML/vtkXMLWriter.cxx +=================================================================== +--- vtk9.orig/IO/XML/vtkXMLWriter.cxx ++++ vtk9/IO/XML/vtkXMLWriter.cxx +@@ -1978,7 +1978,10 @@ int vtkXMLWriter::WriteAsciiData(vtkAbs + ret = 0; + break; + } +- iter->Delete(); ++ if (iter) ++ { ++ iter->Delete(); ++ } + return ret; + } + diff --git a/debian/patches/series b/debian/patches/series index 4143c3413..f342795bb 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -13,3 +13,4 @@ matplotlib_nullptr_s390x.patch gdal-3.13.patch build_reproducibility.patch +fix_xmlwriter_ascii_implicit_cellarray_segfault.patch diff --git a/debian/tests/control b/debian/tests/control index 94e924a99..f4a31062a 100644 --- a/debian/tests/control +++ b/debian/tests/control @@ -1,3 +1,3 @@ -Tests: buildBoolean buildPoint buildVTU buildDistance buildPNG buildVTP +Tests: buildBoolean buildPoint buildVTU buildDistance buildPNG buildVTP writeVTUAsciiImplicitCellTypes Depends: libvtk9-dev, libvtk9-qt-dev, build-essential, cmake Restrictions: allow-stderr diff --git a/debian/tests/writeVTUAsciiImplicitCellTypes b/debian/tests/writeVTUAsciiImplicitCellTypes new file mode 100755 index 000000000..3070953f7 --- /dev/null +++ b/debian/tests/writeVTUAsciiImplicitCellTypes @@ -0,0 +1,73 @@ +#!/bin/sh +# autopkgtest check +# regression test for a vtkXMLWriter::WriteAsciiData() segfault: +# ascii .vtu output of a vtkUnstructuredGrid whose cells all share one +# type (implicit cell-type array, VTK >= 9.6) used to dereference a +# nullptr vtkArrayIterator. + +set -e + +export OMPI_MCA_orte_rsh_agent=/bin/false + +WORKDIR=$(mktemp -d) +trap "rm -rf $WORKDIR" 0 INT QUIT ABRT PIPE TERM +cd $WORKDIR +mkdir src +cd src + +cat < CMakeLists.txt +cmake_minimum_required(VERSION 3.28) +project(demo) +find_package(VTK REQUIRED) + +add_executable(demo demo.cpp) +target_link_libraries(demo \${VTK_LIBRARIES}) +install(TARGETS demo DESTINATION bin) +EOF + +cat < demo.cpp +#include +#include +#include +#include +#include + +int main() +{ + vtkNew points; + points->InsertNextPoint(0, 0, 0); + points->InsertNextPoint(1, 0, 0); + points->InsertNextPoint(2, 0, 0); + + vtkNew cells; + for (vtkIdType i = 0; i < 3; ++i) + { + cells->InsertNextCell(1, &i); + } + + vtkNew grid; + grid->SetPoints(points); + // implicit (constant) cell-type array, since VTK 9.6 + grid->SetCells(VTK_VERTEX, cells); + + vtkNew writer; + writer->SetInputData(grid); + writer->SetFileName("a.vtu"); + writer->SetDataModeToAscii(); + writer->Write(); + + return EXIT_SUCCESS; +} +EOF + +cd .. +mkdir build +cd build +cmake -DCMAKE_INSTALL_PREFIX=./../inst ./../src +make +make install +echo "build: OK" +[ -x demo ] +./demo +cat a.vtu +echo "run: OK" -- 2.30.2